const totalCount = 3
const List = [
  {
    id: '@id',
    name: '张三',
    email: 'test@yahoo.co.jp',
    department: '第一开发部',
    updateTime: '@datetime',
  },
  {
    id: '@id',
    name: '李四',
    email: 'test@163.com',
    department: '第一开发部',
    updateTime: '@datetime',
  },
  {
    id: '@id',
    name: '王五',
    email: 'test@qq.com',
    department: '第二开发部',
    updateTime: '@datetime',
  },
  {
    id: '@id',
    name: '小明',
    email: 'test@163.com',
    department: '第三开发部',
    updateTime: '@datetime',
  },
]
module.exports = [
  {
    url: '/staffManagement/getPager',
    type: 'post',
    response(config) {
      const { name = '', pageNo = 1, pageSize = 20 } = config.body
      let mockList = List.filter((item) => {
        if (name && item.name.indexOf(name) < 0) return false
        return true
      })
      const pageList = mockList.filter(
        (item, index) =>
          index < pageSize * pageNo && index >= pageSize * (pageNo - 1)
      )
      return {
        code: 200,
        msg: 'success',
        totalCount,
        data: pageList,
      }
    },
  },
  {
    url: '/staffManagement/doAdd',
    type: 'post',
    response() {
      return {
        code: 200,
        msg: '模拟保存成功',
      }
    },
  },
  {
    url: '/staffManagement/doEdit',
    type: 'post',
    response() {
      return {
        code: 200,
        msg: '模拟保存成功',
      }
    },
  },
  {
    url: '/staffManagement/doDelete',
    type: 'post',
    response() {
      return {
        code: 200,
        msg: '模拟删除成功',
      }
    },
  },
]
